
import Relay from "react-relay";

export default class GetRolesMutation extends Relay.Mutation {

    static fragments = {};

    getMutation() {
        return Relay.QL`mutation { getRoles }`;
    }

    getVariables() {
        return {
            argsInput: {
                enid: this.props.enid,
                isAll:this.props.isAll
            }
        };
    }

    getFatQuery() {
        return Relay.QL`fragment on getRolesPayload {
            getRoles {
                errorCode
                value
                totalResult
                id
                token
                roles{
                    name
                    description
                    pid
                    roleid{
                        rid
                        enid
                    }
                    used{
                        uid
                        phone
                        name
                        status
                        roleId
                    }
                }
                
            }
        }`;
    }

    getConfigs() {
        return [{
            type: 'REQUIRED_CHILDREN',
            children: [Relay.QL`
             fragment on getRolesPayload {
            getRoles {
                errorCode
                value
                totalResult
                id
                token
                roles{
                    name
                    description
                    pid
                    roleid{
                        rid
                        enid
                    }
                    used{
                        uid
                        phone
                        name
                        status
                        roleId
                    }
                }
                
            }
                }
            `]
        }];
    }

}